import java.util.Scanner;

public class replaceNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个含小写字母和数字的字符串：");
        String s = sc.next();
        String replaceString = replace(s);
        System.out.println(replaceString);
    }

    public static String replace(String s) {
        //1、统计字符串中数字个数
        int length = s.length();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c >= '0' && c <= '9') {
                length += 5; //如果是数字 长度扩增5
            }
        }
        //2、创建新的的字符数组 并 复制将旧的字符串复制到新的字符数组
        char[] str = new char[length];
        for (int i = 0; i < s.length(); i++) {
            str[i] = s.charAt(i);
        }
        //3、使用双指针法 替换数字为number字符 尾部双指针
        for (int i = length - 1, j = s.length() - 1; i >= 0;) {
            if (str[j] >= '0' && str[j] <= '9') {
                str[i--] = 'r';
                str[i--] = 'e';
                str[i--] = 'b';
                str[i--] = 'm';
                str[i--] = 'u';
                str[i--] = 'n';
                j--;
            } else {
                str[i--] = str[j--];
            }
        }
        return new String(str);
    }
}
